﻿@model IEnumerable<Subfaculty.WebApplication.ViewModels.DepartmentViewModel>

@{
    ViewBag.Title = "Учебные кафедры";
    Layout = "~/Views/Shared/_LayoutAllocation.cshtml";
}

@{
	Html.Telerik().Grid(Model)
		.Name("GridDiscipline")
		.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new {style = "margin-left:0"}))
		.DataKeys(keys => keys.Add(c => c.Id))
		.Columns(columns =>
				    {
						columns.Bound(o => o.Title);
						columns.Bound(o => o.Abbreviation);
						columns.Command(commands =>
						                	{
												commands.Edit().ButtonType(GridButtonType.BareImage);
												commands.Delete().ButtonType(GridButtonType.BareImage);
											}).Width(180).Title("Commands");
					}
		)
		.DataBinding(dataBinding =>
				        {
							dataBinding.Server().Select("Index", "Department", new { ajax = true });
							dataBinding.Ajax().Select("_Index", "Department").Enabled(true);
							dataBinding.Ajax()
								.Select("SelectAjaxEditing", "Department")
								.Insert("InsertAjaxEditing", "Department")
								.Update("SaveAjaxEditing", "Department")
								.Delete("DeleteAjaxEditing", "Department");
						})
		.Editable(editing => editing.Mode(GridEditMode.PopUp))
		.Scrollable(scrolling => scrolling.Enabled(true))
		.Scrollable(scrolling => scrolling.Height("600px"))
		.Sortable(sorting => sorting.Enabled(true))
		.Pageable(paging => paging.Enabled(true))
		.Filterable(filtering => filtering.Enabled(true))
		.Selectable(s => s.Enabled(true))
		.Groupable(grouping => grouping.Enabled(true))
		.Footer(true)
		.Render();
}

